/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import acc.LoginInteraction;
import javax.swing.JPanel;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import acc.SizeMonition;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.Vector;
import javax.swing.*;
import gui.ShowMessageDialog;
import entity.Permission;

/**
 *
 * @author Haitm
 */
public class Main extends javax.swing.JFrame {

//    public static int x;
//    public static int y;
    /**
     * Creates new form Main
     */
    public Main() {
        initComponents();
        setIconImage(new ImageIcon(getClass().getResource("/image/globe20green.png")).getImage());
//        if (panelContent.getComponents().length == 0) {
//            callJPanel(panelIndex);
//            Dimension ds = Toolkit.getDefaultToolkit().getScreenSize();
//            x = this.getWidth();
//            y = this.getHeight();
//            motion();
//        }
//        if(panelContent.getComponents().length==0)
//        {

        
//        }
//        JOptionPane.showMessageDialog(this, "Welcome "+userName+" !!!");
        //       System.out.println("Login successful");

    }

//    public void motion() {
//        this.setSize(0, 0);
//        new Thread(new SizeMonition(this, x, y)).start();
//    }
    public static void callJPanel(JPanel jpanel) {
        panelContent.removeAll();
        jpanel.setVisible(false);
        panelContent.add(jpanel, new AbsoluteConstraints(0, 0, panelContent.getWidth(), panelContent.getHeight()));
        jpanel.setVisible(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel3 = new javax.swing.JPanel();
        panelSlidebar = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        btnHome = new javax.swing.JButton();
        btnCampaign = new javax.swing.JButton();
        btnProduct = new javax.swing.JButton();
        btnEstimate = new javax.swing.JButton();
        btnActual = new javax.swing.JButton();
        btnStatistics = new javax.swing.JButton();
        bntMyAccount = new javax.swing.JButton();
        btnAdmin = new javax.swing.JButton();
        btnHelp = new javax.swing.JButton();
        btnAbout = new javax.swing.JButton();
        btnLogOut = new javax.swing.JButton();
        panelContent = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("CIS - Campaign Information System - Aptech World Wide 2012");
        setMinimumSize(new java.awt.Dimension(1200, 700));
        setResizable(false);

        jPanel3.setBackground(new java.awt.Color(250, 250, 250));
        jPanel3.setPreferredSize(new java.awt.Dimension(1200, 700));
        jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        panelSlidebar.setBackground(new java.awt.Color(255, 255, 255));
        panelSlidebar.setPreferredSize(new java.awt.Dimension(180, 700));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/MyLogo.png"))); // NOI18N
        jLabel1.setText("jLabel1");

        jToolBar1.setBackground(new java.awt.Color(255, 255, 255));
        jToolBar1.setBorder(null);
        jToolBar1.setFloatable(false);
        jToolBar1.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jToolBar1.setRollover(true);

        btnHome.setBackground(new java.awt.Color(255, 255, 255));
        btnHome.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnHome.setForeground(new java.awt.Color(51, 153, 0));
        btnHome.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/home-go.png"))); // NOI18N
        btnHome.setText("Home");
        btnHome.setFocusable(false);
        btnHome.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnHome.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnHome.setMaximumSize(new java.awt.Dimension(150, 27));
        btnHome.setMinimumSize(new java.awt.Dimension(150, 27));
        btnHome.setPreferredSize(new java.awt.Dimension(150, 27));
        btnHome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnHomeActionPerformed(evt);
            }
        });
        jToolBar1.add(btnHome);

        btnCampaign.setBackground(new java.awt.Color(255, 255, 255));
        btnCampaign.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnCampaign.setForeground(new java.awt.Color(51, 153, 0));
        btnCampaign.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        btnCampaign.setText("Campaign Master");
        btnCampaign.setFocusable(false);
        btnCampaign.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnCampaign.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnCampaign.setMaximumSize(new java.awt.Dimension(150, 27));
        btnCampaign.setMinimumSize(new java.awt.Dimension(150, 27));
        btnCampaign.setPreferredSize(new java.awt.Dimension(150, 27));
        jToolBar1.add(btnCampaign);

        btnProduct.setBackground(new java.awt.Color(255, 255, 255));
        btnProduct.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnProduct.setForeground(new java.awt.Color(51, 153, 0));
        btnProduct.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        btnProduct.setText("Product Master");
        btnProduct.setFocusable(false);
        btnProduct.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnProduct.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnProduct.setMaximumSize(new java.awt.Dimension(150, 27));
        btnProduct.setMinimumSize(new java.awt.Dimension(150, 27));
        btnProduct.setPreferredSize(new java.awt.Dimension(150, 27));
        jToolBar1.add(btnProduct);

        btnEstimate.setBackground(new java.awt.Color(255, 255, 255));
        btnEstimate.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnEstimate.setForeground(new java.awt.Color(51, 153, 0));
        btnEstimate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        btnEstimate.setText("Estimate Budget");
        btnEstimate.setFocusable(false);
        btnEstimate.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnEstimate.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnEstimate.setMaximumSize(new java.awt.Dimension(150, 27));
        btnEstimate.setMinimumSize(new java.awt.Dimension(150, 27));
        btnEstimate.setPreferredSize(new java.awt.Dimension(150, 27));
        jToolBar1.add(btnEstimate);

        btnActual.setBackground(new java.awt.Color(255, 255, 255));
        btnActual.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnActual.setForeground(new java.awt.Color(51, 153, 0));
        btnActual.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        btnActual.setText("Actual Budget");
        btnActual.setFocusable(false);
        btnActual.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnActual.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnActual.setMaximumSize(new java.awt.Dimension(150, 27));
        btnActual.setMinimumSize(new java.awt.Dimension(150, 27));
        btnActual.setPreferredSize(new java.awt.Dimension(150, 27));
        jToolBar1.add(btnActual);

        btnStatistics.setBackground(new java.awt.Color(255, 255, 255));
        btnStatistics.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnStatistics.setForeground(new java.awt.Color(51, 153, 0));
        btnStatistics.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        btnStatistics.setText("Statistics");
        btnStatistics.setFocusable(false);
        btnStatistics.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnStatistics.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnStatistics.setMaximumSize(new java.awt.Dimension(150, 27));
        btnStatistics.setMinimumSize(new java.awt.Dimension(150, 27));
        btnStatistics.setPreferredSize(new java.awt.Dimension(150, 27));
        jToolBar1.add(btnStatistics);

        bntMyAccount.setBackground(new java.awt.Color(255, 255, 255));
        bntMyAccount.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        bntMyAccount.setForeground(new java.awt.Color(51, 153, 0));
        bntMyAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        bntMyAccount.setText("My Account");
        bntMyAccount.setFocusable(false);
        bntMyAccount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        bntMyAccount.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        bntMyAccount.setMaximumSize(new java.awt.Dimension(150, 27));
        bntMyAccount.setMinimumSize(new java.awt.Dimension(150, 27));
        bntMyAccount.setPreferredSize(new java.awt.Dimension(150, 27));
        jToolBar1.add(bntMyAccount);

        btnAdmin.setBackground(new java.awt.Color(255, 255, 255));
        btnAdmin.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnAdmin.setForeground(new java.awt.Color(51, 153, 0));
        btnAdmin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        btnAdmin.setText("Administrator");
        btnAdmin.setFocusable(false);
        btnAdmin.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnAdmin.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnAdmin.setMaximumSize(new java.awt.Dimension(150, 27));
        btnAdmin.setMinimumSize(new java.awt.Dimension(150, 27));
        btnAdmin.setPreferredSize(new java.awt.Dimension(150, 27));
        btnAdmin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAdminActionPerformed(evt);
            }
        });
        jToolBar1.add(btnAdmin);

        btnHelp.setBackground(new java.awt.Color(255, 255, 255));
        btnHelp.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnHelp.setForeground(new java.awt.Color(51, 153, 0));
        btnHelp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        btnHelp.setText("Help");
        btnHelp.setFocusable(false);
        btnHelp.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnHelp.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnHelp.setMaximumSize(new java.awt.Dimension(150, 27));
        btnHelp.setMinimumSize(new java.awt.Dimension(150, 27));
        btnHelp.setPreferredSize(new java.awt.Dimension(150, 27));
        jToolBar1.add(btnHelp);

        btnAbout.setBackground(new java.awt.Color(255, 255, 255));
        btnAbout.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnAbout.setForeground(new java.awt.Color(51, 153, 0));
        btnAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_world_mini.png"))); // NOI18N
        btnAbout.setText("About");
        btnAbout.setFocusable(false);
        btnAbout.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnAbout.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnAbout.setMaximumSize(new java.awt.Dimension(150, 27));
        btnAbout.setMinimumSize(new java.awt.Dimension(150, 27));
        btnAbout.setPreferredSize(new java.awt.Dimension(150, 27));
        jToolBar1.add(btnAbout);

        btnLogOut.setBackground(new java.awt.Color(255, 255, 255));
        btnLogOut.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnLogOut.setForeground(new java.awt.Color(51, 153, 0));
        btnLogOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/user-group-logout.png"))); // NOI18N
        btnLogOut.setText("Log Out");
        btnLogOut.setFocusable(false);
        btnLogOut.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnLogOut.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnLogOut.setMaximumSize(new java.awt.Dimension(150, 27));
        btnLogOut.setMinimumSize(new java.awt.Dimension(150, 27));
        btnLogOut.setPreferredSize(new java.awt.Dimension(150, 27));
        btnLogOut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLogOutActionPerformed(evt);
            }
        });
        jToolBar1.add(btnLogOut);

        javax.swing.GroupLayout panelSlidebarLayout = new javax.swing.GroupLayout(panelSlidebar);
        panelSlidebar.setLayout(panelSlidebarLayout);
        panelSlidebarLayout.setHorizontalGroup(
            panelSlidebarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelSlidebarLayout.createSequentialGroup()
                .addGroup(panelSlidebarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 2, Short.MAX_VALUE))
        );
        panelSlidebarLayout.setVerticalGroup(
            panelSlidebarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelSlidebarLayout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 84, Short.MAX_VALUE)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 446, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel3.add(panelSlidebar, new org.netbeans.lib.awtextra.AbsoluteConstraints(1020, 0, -1, -1));

        panelContent.setBackground(new java.awt.Color(255, 255, 0));
        panelContent.setMaximumSize(new java.awt.Dimension(1020, 700));
        panelContent.setMinimumSize(new java.awt.Dimension(1020, 700));
        panelContent.setPreferredSize(new java.awt.Dimension(1020, 700));
        panelContent.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        jPanel3.add(panelContent, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnHomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHomeActionPerformed
        // TODO add your handling code here:
        callJPanel(panelIndex);
    }//GEN-LAST:event_btnHomeActionPerformed

    private void btnLogOutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLogOutActionPerformed
        // TODO add your handling code here:

        new ShowMessageDialog(this, true, "Do you want to sign out?", ShowMessageDialog.CONFIRM);
        if (ShowMessageDialog.STATUS == ShowMessageDialog.OK) {
            Permission.ACTUAL_BUDGET = false;
            Permission.ADMINISTRATOR = false;
            Permission.CAMPAIGN_MASTER = false;
            Permission.ESTIMATED_BUDGET = false;
            Permission.PRODUCT_MASTER = false;
            Permission.READ_ONLY = false;
            Permission.STATISTICS = false;
            LoginDialog.setStatus(false);
            setVisible(false);
//            new LoginDialog(null, true);
//            if (LoginDialog.getStatus()) {
//                new com.aptech.cis.lib.progress(null, true);
//                campaign_master = new CampaignMaster();
//                actual_budget = new ActualBudget();
//                estimated_budget = new EstimatedBudget();
//                admin_panel = new Administration();
//                product_master = new ProductMaster();
//                STATUS = STARTPANEL;
//                callJPanel(start_pannel);
//                Dimension ds = Toolkit.getDefaultToolkit().getScreenSize();
//                x = this.getWidth();
//                y = this.getHeight();
//                motion();
            login();
            //setVisible(true);
        }
//        }
    }//GEN-LAST:event_btnLogOutActionPerformed

    private void btnAdminActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdminActionPerformed
        // TODO add your handling code here:
        if (entity.Permission.ADMINISTRATOR == true) {
            Main.callJPanel(new Administrator());
        } else {
            new ShowMessageDialog(null, true, "You no have permission access ", ShowMessageDialog.MESSAGE);
        }
    }//GEN-LAST:event_btnAdminActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
//        /*
//         * Set the Nimbus look and feel
//         */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /*
//         * If Nimbus (introduced in Java SE 6) is not available, stay with the
//         * default look and feel. For details see
//         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /*
//         * Create and display the form
//         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
//                new Main().setVisible(true);
                try {
                    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                    //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

                } catch (ClassNotFoundException ex) {
                    System.out.println(ex.getMessage());
                } catch (InstantiationException ex) {
                    System.out.println(ex.getMessage());
                } catch (IllegalAccessException ex) {
                    System.out.println(ex.getMessage());
                } catch (UnsupportedLookAndFeelException ex) {
                    System.out.println(ex.getMessage());
                } //***********************************************************
                finally {
                    //new com.aptech.cis.lib.progress(null, true);
                    acc.DataInteraction.configServer();
                    Vector users = LoginInteraction.getUser();
                    if (users.size() == 0) {
                        //PHAI THEM CONFIG SERVER LAN DAU DIEN, ServerConfig config = new ServerConfig();
                        new ShowMessageDialog(null, true, "No User in database, let's create one now. The first User have bean created will be the Administrator account by default!!", ShowMessageDialog.MESSAGE);
                        CreateAccountDialog newAcc = new CreateAccountDialog(null, true);
                        login();
                    } else {
                        login();
                    }

                }
            }
        });

    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bntMyAccount;
    private javax.swing.JButton btnAbout;
    private javax.swing.JButton btnActual;
    private javax.swing.JButton btnAdmin;
    private javax.swing.JButton btnCampaign;
    private javax.swing.JButton btnEstimate;
    private javax.swing.JButton btnHelp;
    private javax.swing.JButton btnHome;
    private javax.swing.JButton btnLogOut;
    private javax.swing.JButton btnProduct;
    private javax.swing.JButton btnStatistics;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JToolBar jToolBar1;
    public static javax.swing.JPanel panelContent;
    private javax.swing.JPanel panelSlidebar;
    // End of variables declaration//GEN-END:variables
    static Index panelIndex = new Index();
    public static String userName;

    private static void login() {
        LoginDialog loginD = new LoginDialog(null, true); // call login dialog
        if (LoginDialog.getStatus()) {
            //implement main frame
//                new com.aptech.cis.lib.progress(null, true);

            Main mainWindow = new Main();
            mainWindow.setLocationRelativeTo(null);
//                        JOptionPane.showMessageDialog(null, LoginDialog.getUsername());
//            ShowMessageDialog message = new ShowMessageDialog(null, true, "Login successful, " + "Welcome " + LoginDialog.getUsername() + " !!!", ShowMessageDialog.MESSAGE);
            mainWindow.setVisible(true);
            callJPanel(panelIndex);
        } else {
            System.exit(0);
        }
    }
}
